<title>注册系统</title>
<style>
input{
    margin: 20px;
}
form{
    border-radius: 10px;
}
</style>
<body>
<h1>欢迎使用注册系统</h1>
<form>
    <br>
    <label for="sn">学号</label>
    <input type="text" name="" value="" id="sn">
    <br>
    <label for="pswd">密码</label>
    <input type="password" name="" value="" id="pswd">
    <br>
    <label for="sn">性别</label>
    <input type="text" name="" value="" id="sex">
    <br>
    <label for="sn">姓名</label>
    <input type="text" name="" value="" id="name">
    <br>
    <label for="sn">年级</label>
    <input type="text" name="" value="" id="grade">
    <br>
    <label for="sn">班级</label>
    <input type="text" name="" value="" id="classname">
    <br>
    <input onclick="zc()" value="注册" class="button" type="button"></input>
    <br>
</form>
</body>

<script>
    function zc() {
        var userinfo = new Object();
        userinfo.Sn = document.getElementById("sn").value;
        userinfo.Pswd = document.getElementById("pswd").value;
        userinfo.Sex = document.getElementById("sex").value;
        userinfo.Name = document.getElementById("name").value;
        userinfo.Grade = document.getElementById("grade").value;
        userinfo.Classname = document.getElementById("classname").value;

        fetch("/doRegister", {
            method:"post",
            body:JSON.stringify(userinfo)
        }).then(
            alert("注册成功")
        )
    }
</script>